<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p1 = new Promise((resolve,reject)=>{

            try{
                setTimeout(()=>{
                    resolve('成功')
                })
            }catch(e){
                reject(e)
            }
        },2000)

        const p2 = p1.then(()=>{
            return new Promise((resolve,reject)=>{
                try{
                    setTimeout(()=>{
                        // resolve('成其他功')
                        reject('shibai')
                    })
                }catch(e){
                    reject(e)
                }
            });
        })
        // p1的返回一个成功的promise，p2接s
        p2.then((value)=>{
            console.log(value);
        })
        console.log(p2);
    </script>
</body>
</html>